﻿////using ClientTools.Library.DataTypes.Nodes;
////using ClientTools.Library.DataTypes.Umbraco;

////namespace ClientTools.Library
////{
////    public class Convert
////    {
////        //public static Node ToNode(umbraco.cms.businesslogic.web.Document doc, bool recursive)
////        //{
////        //    var returnValue = new Node
////        //                          {
////        //                              Id = doc.Id,
////        //                              Name = doc.Text,
////        //                              NodeTypeAlias = doc.ContentType.Alias,
////        //                              NodeTypeId = doc.ContentType.Id,
////        //                              ChildrenLoaded = false
////        //                          };
////        //    foreach (var item in doc.getProperties)
////        //        returnValue.Properties.Add(ToProperty(item));
////        //    if (recursive)
////        //        returnValue.Children = ToNodeCollection(doc.Children, true);
////        //    return returnValue;
////        //}

////        //public static Property ToProperty(umbraco.cms.businesslogic.property.Property prop)
////        //{
////        //    var returnValue = new Property
////        //                          {
////        //                              Id = prop.Id,
////        //                              PropertyTypeAlias = prop.PropertyType.Alias,
////        //                              PropertyTypeId = prop.PropertyType.Id
////        //                          };
////        //    try
////        //    {
////        //        returnValue.Value = (string)prop.Value;
////        //    }
////        //    catch (System.Exception)
////        //    {
////        //        returnValue.Value = "Not Converted";
////        //    }
////        //    //if (prop.Value == null || string.IsNullOrEmpty((string)prop.Value))
////        //    //    returnValue.Value = "";
////        //    //else
////        //    //    returnValue.Value = (string)prop.Value;
////        //    return returnValue;
////        //}

////        //public static NodeCollection ToNodeCollection(umbraco.cms.businesslogic.web.Document[] docs, bool recursive)
////        //{
////        //    var returnValue = new NodeCollection();
////        //    foreach (var item in docs)
////        //        returnValue.Add(ToNode(item, recursive));
////        //    return returnValue;
////        //}

////        //public static Node ToVersion(umbraco.cms.businesslogic.web.Document doc, bool recursive)
////        //{
////        //    Node returnValue = new Node() { Id = doc.Id, Name = doc.Text, NodeTypeAlias = doc.ContentType.Alias, NodeTypeId = doc.ContentType.Id, ChildrenLoaded = false };
////        //    foreach (var item in doc.getProperties)
////        //        returnValue.Properties.Add(Convert.ToProperty(item));
////        //    if (recursive)
////        //        returnValue.Children = Convert.ToNodeCollection(doc.Children, recursive);
////        //    return returnValue;
////        //}

////        //public static VersionCollection ToVersionCollection(umbraco.cms.businesslogic.web.DocumentVersionList[] versions)
////        //{
////        //    VersionCollection returnValue = new VersionCollection();
////        //    foreach (var item in versions)
////        //        returnValue.Add(new Version() { Guid = item.Version, Date = item.Date, Text = item.Text, UserId = item..User.Name });
////        //    return returnValue;
////        //}
////    }
////}
